<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/commonJS.jsp" %>
<%@ include file="../common/commonLabel.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>下拉选设定</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<script language="javascript">
function doInsType(){
	if(check()){
		if(confirm("确认保存信息？")){
			document.all.operate.value = "insinfo";
			document.forms[0].submit();
		}
	}
}
//添加行功能
function addTRs(obj) {
	var tr = obj["parentNode"]["parentNode"];
	var tab = tr["parentNode"];
	if(obj["title"] == "添加") {
		var trs = tr["cloneNode"](1);
		var newTr = trs["childNodes"];
		for(var i = 0; i < newTr["length"]; i++) {
			if(newTr[i]["firstChild"]["tagName"] == "INPUT") {
				if(newTr[i]["firstChild"]["type"] == "button"){
					continue;
			    }else{
					newTr[i]["firstChild"]["value"] = "";
				}
			} else if (newTr[i]["firstChild"]["tagName"] == "SELECT") {	
				//newTr[i]["firstChild"]["value"] = "请选择";
			}
		}
		trs["lastChild"]["firstChild"]["title"] = "删除";
		trs["lastChild"]["firstChild"]["innerHTML"] = "删除";
		trs["lastChild"]["firstChild"]["style"]["cssText"] = "";
		tab["appendChild"](trs);
	} else {
		tab["removeChild"](tr);	
	}
}
 //限制添加快捷内容的字数  
var maxLength =30; 
function MaxInput(fo,len) {
	if(len!=""){
		maxLength=len;
	}
	if (fo.value.length > maxLength) {
		alert("输入内容过多！");
		fo.value = fo.value.substring(0, maxLength);
	}
}
//验证标识不能重复
function doChecking(obj){
	if(obj.value!=""){
		ajax.checkOneData("pres_selecttype","typechar",obj.value,function(back){
			if(back){
				_alert(obj.title + "重复，请重新输入。");
				obj.value = "";
				obj.focus();
			}
		});
	}
}
</script>
</head>
<body >
<form name="form1" method="post" action="<%=path %>/aidedmanage.action">
<script type="text/javascript">
if('${msg}'=='true'){
	_alert('保存成功');
	doclose();
	parent.document.forms[0].submit();
}else if('${msg}'=='false'){
	_alert('保存失败');
}
</script>
<table width="100%" height="99%" border="0" cellpadding="0" cellspacing="0" >
    <tr>
      <td class="MainBody_body" style="padding:10 20px 0 0;"><input name="operate" type="hidden" value=""/>
      <div align="right" style="padding: 0 10 10 0;">
      	 <input type="button" class="btn" value="保 存" onclick="doInsType()"/>&nbsp;&nbsp;
		 <input type="button" class="btn" value="关 闭" onclick="doclose()"/>&nbsp;&nbsp;</div>
      <table  border="0" cellpadding="0" cellspacing="0" class="MainBody_table">
            <tr>
              <td  colspan="8" class="bg_title">下拉选信息</td>
            </tr>
            <tr>
              <th width="20%" nowrap="nowrap">下拉选名称</th> 
              <td width="35%"><input name="typename" type="text" check="checkBlank" title="下拉选名称" maxlength="50" class="notnull"/></td>
              <th width="20%" nowrap="nowrap">当前时间</th>
              <td width="25%"><input name="createtime" type="text" value="${createtime}" class="readinput" readonly/></td>
            </tr>
            <tr>
         	  <th nowrap="nowrap">下拉选标识</th>
              <td ><input name="typechar" type="text" check="checkBlank,checkChar" title="下拉选标识" maxlength="30" onblur="doChecking(this)" class="notnull"/></td>
              <th nowrap="nowrap">当前用户</th> 
              <td ><input name="createuser" type="hidden" value="${sessionScope.admin_user.personid}"/>
              <input value="${sessionScope.admin_user.personname}" class="readinput" readonly/></td>
            </tr>
		</table>
        <table  border="0" cellpadding="0" cellspacing="0" class="MainBody_table2">
        	<tr>
              <td colspan="3" class="bg_title">下拉选内容信息</td>
            </tr>
            <tr>
              <th nowrap="nowrap">内容信息</th>
              <th width="25%" nowrap="nowrap">位置排序</th>
              <th width="15%" nowrap="nowrap">操作</th>
            </tr>
            <tr>
            	<td ><input name="selectvalue" type="text" check="checkBlank" title="内容信息" maxlength="15" onkeyup="checkKey(this,0)" class="notnull"/></td>
				<td ><input name="selectdsc" type="text" check="checkBlank,checkInt" title="位置排序" maxlength="15" class="notnull"/></td>
				<td ><span class='RoleSpan' onclick='addTRs(this)' title='添加' onmouseout="doMsOut()" onmouseover='doMsOver()'>添加</span></td>
            </tr>
        </table>
      </td>
  </tr>
</table>
</form>
  </body>
</html>
